package com.jerome.rmi;

import java.rmi.Remote;
import java.rmi.RemoteException;

/**
 * Calculator
 * @author jerome
 * @date 2023/7/28
 */
public interface Calculator extends Remote {
    /**
     * This is a test
     * please ignore
     * @param name any string
     * @return test string
     * @throws RemoteException
     */
    @Deprecated
    String test(String name) throws RemoteException;

    /**
     *  This method will pop the top of the stack and return it to the client.
     * @return the top of the stack
     * @throws RemoteException
     */
    int pop() throws RemoteException;

    /**
     * This method will return true if the stack is empty, false otherwise
     * @throws RemoteException
     */
    boolean isEmpty() throws RemoteException;

    /**
     * This method will wait millis milliseconds before carrying out the pop operation as above.
     * @param millis wait millis milliseconds
     * @throws RemoteException
     */
    int delayPop(int millis) throws RemoteException, InterruptedException;

    /**
     * This method will take val and push it on to the top of the stack
     * @param val take it to stack
     * @throws RemoteException
     */
    void pushValue(int val) throws RemoteException;

    /**
     * This method wi push a String containing an operator (" min" "max "cm""gcd") to the stack which wil cause the server to pop al the values on the stack
     * @param operator  (" min" "max "cm""gcd")
     * @throws RemoteException
     */
    void pushOperation(String operator) throws RemoteException;


}
